@import "../../components/-vars-media";

.kotlin-code-examples-section {
  $legend-width: 180px;
  $legend-spacing: 10px;

  position: relative;
  padding-top: var(--xxl-space);

  &__title {
    font-weight: bold;
    font-size: 31px;
    line-height: 41px;
    margin-bottom: 30px;
  }

  &__run {
    &, &:hover, &:active, &:focus {
      color: #fff;
      background: transparent;
      box-shadow: 0 0 0 transparent;
      border: 0 none transparent;
      text-shadow: 0 0 0 transparent;
      outline: 0 none transparent;
    }

    & {
      display: none;
      cursor: pointer;
      font-size: 16px;
      line-height: 24px;
      margin-right: 16px;

      .page_js_yes & {
        display: flex;

        &_hide {
          display: none;
        }
      }

      &, &:hover, &:active, &:focus {
        background: #7F52FF url("./images/run_icon.svg") 29px center no-repeat;
      }

      align-items: center;
      box-sizing: border-box;
      padding: 8px 24px 8px 56px;
      border-radius: 24px;

      @media (max-width: 720px) {
        &, &:hover, &:active, &:focus {
          background-position: center center;
          border-radius: 0 8px 0 0;
          padding: 0;
          text-indent: -9999px;
          margin-right: 0;
          height: 48px;
          min-width: 48px;
          width: 48px;
        }
      }
    }
  }

  .executable-fragment.darcula,
  .sample[theme=darcula] {
    background: #1b1b1b;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
    border: 0 none transparent;
  }

  .sample[theme=darcula] {
    padding: 20px 0 0 0;
  }

  .cm-s-darcula.CodeMirror,
  .output-wrapper.darcula {
    background: transparent;
  }

  .CodeMirror pre.CodeMirror-line {
    font-size: 16px;
    line-height: 24px;

    @media (max-width: 1024px) {
      font-size: 16px;
      line-height: 24px;
    }
  }

  .run-button {
    display: none;
  }

  .ERRORgutter, .WARNINGgutter {
    margin-top: 2 * $unit;
  }

  .CodeMirror-gutters {
    background: none !important;
    border-right: none !important;
  }

  .code-output {
    overflow-y: hidden;
  }

  .output-wrapper.darcula {
    min-height: 120px;
    font-size: 16px;
    line-height: 24px;

    border: 0 none transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

  .console-close {
    top: 5px;
    right: 5px;
    height: 16px;
    width: 16px;
  }

  .compiler-info__target, .compiler-info__version {
    display: none;
  }

  .compiler-info__open-editor-link {
    font-size: 13px;
    line-height: 20px;
    color: rgba(255, 255, 255, 0.5);
  }

  & .is_hidden {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .code-line {
    @include clearfix;
    position: relative;
    text-align: left;
  }

  .code {
    float: left;
    margin-right: $legend-spacing - 2px;
    font-family: 'Droid Sans Mono', $font-family-mono;
    font-size: 30px;
    line-height: 37px;
    color: #9ebdd9;
    white-space: pre;

    .generic-code {
      color: #9ebdd9;
    }
    .keyword {
      color: #ff8b17;
    }
    .class-name {
      color: #9ebdd9;
    }
    .func-name {
      color: #ffcf7f;
    }
    .buildin-func-name {
      color: #b1c4d8;
      font-weight: bold;
      font-style: italic;
    }
    .string-literal {
      color: #78a35f;
    }
    .var-name {
      color: #a165cb;
    }
    .number {
      color: #3489ca;
    }
    .string-literal-var-substitution {
      color: #ff8b17;
    }
  }

  .code-legend {
    position: relative;
    white-space: normal;

    @media (max-width: 900px) {
      display: none !important;
    }

    &.align_left {
      position: absolute;
      display: block;
      right: 100%;
    }

    &.align_right {
      display: table;
      margin-right: $legend-width;

      &:after {
        content: '. .';
        display: block;
        word-spacing: 99in;
        height: 0;
        overflow: hidden;
        font-size: 0;
        line-height: 0;
      }
    }
  }
  .ie & .code-legend.align_right:after {
    font-size: 1px;
  }

  .code-legend-line {
    position: absolute;
    top: 21px;
    height: 1px;
    background-color: #fff;
    opacity: 0.2;
  }

  .code-legend.align_left .code-legend-line {
    right: 0;
    width: 30px;
    margin-right: $legend-spacing;
  }
  .code-legend.align_right .code-legend-line {
    left: 0;
    right: 0;
  }

  .code-legend-text {
    position: absolute;
    z-index: 1;
    top: 11px;
    width: $legend-width;

    a {
      color: #fff;

      &:hover {
        color: $base-link-hover-color;
      }
    }
  }
  .code-legend.align_left .code-legend-text {
    right: 100%;
    margin-right: 30px + $legend-spacing*2;
    text-align: right;
  }
  .code-legend.align_right .code-legend-text {
    left: 100%;
    margin-left: $legend-spacing;
  }

  .code-legend-line-marker {
    position: absolute;
    //right: 100%;
    top: 5px;
    width: 33px;
    height: 33px;
    border: 1px solid #fff;
    border-radius: 100%;
    opacity: 0.2;
  }

  .theme-darcula-wrapper .executable-fragment-wrapper__shorter {
    &, &:hover, &:active {
      background-image: url("images/shorter.svg");
      background-color: #1b1b1b;
      border: 0 none transparent;
      border-radius: 27px;
      height: 40px;
      width: 40px;
    }
  }
}

.kotlin-overview-code-example-tabs {
  display: flex;
  flex-direction: column;
  position: relative;

  &__group {
    display: flex;
    align-items: center;
    background-color: #1b1b1b;
    border-top-right-radius: 8px;
    border-top-left-radius: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  &__button {
    align-self: center;
    margin-top: 48px;
  }

  & .executable-fragment-wrapper {
    margin-bottom: 0;
  }

  &:before {
    position: absolute;
    z-index: 1;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0;
    content: '';
  }

  .tab {
    @include user-select(none);

    position: relative;
    display: inline-block;
    cursor: pointer;

    color: rgba(255, 255, 255, 0.6);

    font-family: Inter, Arial, sans-serif;
    font-size: 16px;
    line-height: 24px;

    @media (max-width: 720px) {
      font-size: 16px;
      line-height: 24px;
      padding-top: 12px;
      padding-bottom: 12px;
    }

    font-style: normal;
    font-weight: normal;

    margin: 0 0 0 32px;
    padding-top: 16px;
    padding-bottom: 16px;

    z-index: 2;

    &:hover, &.is_active  {
      color: #fff;
    }

    &:first-of-type {
      margin-left: 0;
    }

    &.is_active {
      cursor: default;

      &:after {
        display: block;
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 2px;
        background-color: white;
      }

      &:last-child {
        border-right-width: 1px;
      }
    }
  }

  .overview-group {
    display: flex;
    flex-grow: 1;
    padding: 0 16px;
    overflow-x: scroll;

    .page_js_yes & {
      overflow: hidden;
    }

    -moz-user-select:none;
    -webkit-user-select:none;
    user-select:none;

    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;

    .tab-text {
      white-space: nowrap;
    }

    .overview-examples {
      display: flex !important;
      align-items: center;
      float: right;
      text-decoration: none;
      color: white !important;

      &::after {
        display: inline-block;
        content: '';
        height: 10px;
        width: 10px;
        margin-left: 1 * $unit;
        background: url("./images/external-link-marker_fff.svg") no-repeat;
        background-size: 10px;
      }
    }
  }

  .js-code-output-executor.darcula {
    border: 0 none transparent;
  }
}
